﻿using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Collections.Generic;
using System.Text;

namespace ConsoleService
{
    [ServiceContract]
    public class Service
    {
        [OperationContract]
        public int Calculate(Operation op, int a, int b)
        {

            Trace.Listeners["AzureDiagnostics"].WriteLine("Performing operation: " + op);

            switch (op)
            {
                case Operation.Add:
                    return a + b;
                    break;

                case Operation.Subtract:
                    return a - b;
                    break;

                case Operation.Multiply:
                    return a * b;
                    break;

                case Operation.Divide:
                    return a / b;
                    break;
            }

            return 0;
        }
    }

    public enum Operation
    {
        Add,
        Subtract,
        Multiply,
        Divide
    }
}
